<template>
  <div class="header">
    <div class="header_top">
      <div class="wrapper">
        <div class="left">四川化工职业技术学院欢迎您</div>
        <div class="right">学校主页</div>
      </div>
      <div class="img">
        <img src="http://sccc.edu.cn/images/202000603_banner.png" />
      </div>
    </div>
    <div class="header_main">
      <div class="wrapper">
        <ul class="menu">
            <li>网站首页</li>
          <li v-for="c in category" :key="c.id">{{ c.name }}</li>
        </ul>
      </div>
    </div>
  </div>
</template>
  
  <script>
import { get } from "../../utils/request";

export default {
  data() {
    return {
      category: [],
    };
  },
  methods: {
    loadCategory() {
      var url = "/index/category/findAll";
      get(url).then((resp) => {
        this.category = resp.data;
        console.log(resp.data);
      });
    },
  },
  created() {
    this.loadCategory();
  },
};
</script>
  
  <style lang="scss">
  $color_primary:#3d9bf0;
.header {
  .header_top {
    background-color:$color_primary;
    color: #fff;

    &img {
      margin-left: 10%;
    }
    &>.wrapper::after{
        display: block;
        clear: both;
        content:'';
    }
    .left,
    .right {
      line-height: 3em;
      cursor: pointer;
    }
    .left {
      float: left;
    }
    .right {
      float: right;
    }
  }
  .header_main {height: 30px;
    font-size: medium;
    ul.menu{
        &>li{
            float: left;
            padding: .5em 2em;
            cursor: pointer;
        }
        &>li.current,
        &>li:hover{
            background-color:$color_primary ;
            color:#fff
        }
    }
  }
}
</style>
